package cn.fboost.mtos.mapper;

import cn.fboost.mtos.dto.request.PageRequest;
import cn.fboost.mtos.entity.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface OrderMapper {
    int create(Order order);
    int update(Order order);
    int deleteById(int id);
    Order findById(int id);
    Order findByTradeNo(String tradeNo);
    Order findByTradeNoAndUserId(@Param("tradeNo") String tradeNo, @Param("userId") int userId);
    Order findByOutTradeNo(String outTradeNo);
    Order findByOutTradeNoAndUserId(@Param("outTradeNo") String outTradeNo, @Param("userId") int userId);
    List<Order> listBy(@Param("order") Order order, @Param("pagination") PageRequest.PageOffset pagination);
    int closeUnpaidOrder();
    int autoFinish();
    int countByStatus(int status);
    int count(Order order);
}
